/*
 * (C) Copyright 2016 Ymatou (http://www.ymatou.com/).
 * 
 * All rights reserved.
 */
package com.ymatou.iapi.userservice.parameter.enums;

/**
 * 用户语言
 * @author zhongwei
 *
 */
public enum VisitLanguageEnum {

    /**
     * 中文
     */
    Chinese(0, "Chinese"),

    /**
     * English
     */
    English(1, "English"),
    ;

    private Integer code;

    private String message;

    VisitLanguageEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 通过错误码获取枚举项
     *
     * @param code
     * @return
     */
    public static VisitLanguageEnum getByCode(Integer code) {
        for (VisitLanguageEnum visitLanguageEnum : VisitLanguageEnum.values()) {
            if (visitLanguageEnum.getCode() == code) {
                return visitLanguageEnum;
            }
        }
        return null;
    }
}
